<!--#include file="lib/utf-8.asp"-->
<!--#include file="lib/conn.asp"-->
<!--#include file="lib/saferequest.asp"-->
<%
	sql="select * from yb LEFT JOIN cl ON yb.cyr = cl.clid where datediff('m',rq,date())=0 order by rq,tyr,cyr,dd,id"
	'response.write sql
	set rs = Server.CreateObject("ADODB.Recordset")
	rs.open sql,conn,1,1
	If rs.eof Then
		response.write("没有检索到数据!")
		response.end
	End if
If saferequest("page",0)<>""  Then	page=clng(saferequest("page",0)) Else	page=1
rs.pagesize=30
pagesize=rs.pagesize
pagecount=rs.pagecount
'page=clng(request.QueryString("page"))
if Not IsEmpty(page) then '如果page_num已经初始化...
	if Not IsNumeric(page) then '判断page_num值是否为数字
		page=1
	else
		page = clng(page) '接收page_num并化为数字型赋给page_num变量
	end if
	if page > pagecount then '如果接收的页数大于总页数
		rs.AbsolutePage = pagecount '设置当前显示页等于最后页
	elseif page <= 0 then '如果page小于等于0
		page=1
		rs.AbsolutePage = page '设置当前显示页等于第一页
	else
		rs.AbsolutePage = page '如果大于零,显示当前页等于接收的页数
	end if
	page = rs.AbsolutePage
end if
%>
<table class="contable">
 <thead>
	<tr>
    <th>序号</th>
		<th>货单日期</th>
    <th>托运人</th>
    <th>承运人</th>
    <th>地点</th>
    <th>时间</th>
    <th>船名/航次</th>
    <th>提单号</th>
    <th>箱型</th>
    <th>箱号</th>
		<th>封号</th>
		<th>应收运费</th>
		<th>应付运费</th>
		<th>堆存费</th>
		<th>提箱</th>
		<th>还箱</th>
		<th>进港费</th>
		<th>其他</th>
		<th>备注</th>
		<th>已收</th>
		<th>已付</th>
  </tr>
</thead>
<tbody>
<%
'while not rs.eof
for i=1 to pagesize
	if rs.EOF then	Exit For
%>
  <tr>
    <td><a href="view.asp?id=<%=rs("id")%>" target="_blank"><%=rs.AbsolutePosition%></a></td>
    <td><%=rs("rq")%></td>
    <td><%=rs("tyr")%></td>
    <td><%=rs("clm")%></td>
    <td><%=rs("dd")%></td>
    <td><%if not isnull(rs("sj")) then response.write(FormatDateTime(rs("sj"),4))%></td>
    <td><%=rs("cmhc")%></td>
    <td><%=rs("tdh")%></td>
    <td><%=rs("xx")%></td>
		<td><%=rs("xh")%></td>
		<td><%=rs("fh")%></td>
		<td><%=rs("yj")%></td>
		<td><%=rs("jsj")%></td>
		<td><%=rs("dcf")%></td>
		<td><%=rs("tx")%></td>
		<td><%=rs("hx")%></td>
		<td><%=rs("jgf")%></td>
		<td><%=rs("qtf")%></td>
		<td><%=rs("bz")%></td>
		<td><%if rs("js") then response.write("√")%></td>
		<td><%if rs("yf") then response.write("√")%></td>
  </tr>
<%
	sum_dcf=sum_dcf+rs("dcf")
	sum_jgf=sum_jgf+rs("jgf")
	sum_yj=sum_yj+rs("yj")
	sum_jsj=sum_jsj+rs("jsj")
	sum_qtf=sum_qtf+rs("qtf")
	rs.movenext()
'wend
Next
%>
</tbody>
	<tfoot>
  <tr>
    <th>合计</th>
		<th>&nbsp;</th>
    <th>&nbsp;</th>
    <th>&nbsp;</th>
    <th>&nbsp;</th>
    <th>&nbsp;</th>
    <th>&nbsp;</th>
    <th>&nbsp;</th>
    <th>&nbsp;</th>
    <th>&nbsp;</th>
		<th>&nbsp;</th>
		<th><%=sum_yj%></th>
		<th><%=sum_jsj%></th>
		<th><%=sum_dcf%></th>
    <th>&nbsp;</th>
    <th>&nbsp;</th>
		<th><%=sum_jgf%></th>
		<th><%=sum_qtf%></th>
		<th>&nbsp;</th>
		<th>&nbsp;</th>
		<th>&nbsp;</th>
  </tr>
	</tfoot>
</table>
<span id="pagebar">
	<%	If page>1 Then	%>
		[<a href="#" id="1">首页</a>]
		[<a href="#" id="<%=page-1%>">上一页</a>]
	<%
			End If
			If Not (page>=pagecount Or pagecount=0) Then
	%>
		[<a href="#" id="<%=page+1%>">下一页</a>]
		[<a href="#" id="<%=pagecount%>">尾页</a>]
	<%	End If %>
		第 <%=page%> 页 / 共 <%=pagecount%> 页
		转到<input id="page_val" type="text" size="2" maxlength="<%=Int(Log(pagecount))+1%>" value="<%=page%>" />页
		<input id="page_go" type="button" value="Go" />
</span>
<%
rs.close
Set rs=nothing
conn.close
Set conn=nothing
%>
